package cn.wen.yaling.xo.dao;

import cn.wen.yaling.commons.entity.TypeEntity;
import cn.wen.yaling.commons.vo.TypeVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 
 * 
 * @author FY
 * @email 932043654@qq.com
 * @date 2022-08-13 02:07:37
 */
@Mapper
@Component
public interface TypeDao extends BaseMapper<TypeEntity> {

    /**
     * 通过subjectId获取排好序的列表
     * @param subjectId
     * @return
     */
    List<TypeEntity> getSubjectAllTypeBySubjectId(@Param("subjectId") Integer subjectId);


    /**
     * 通过typeId来获取数量
     * @param typeId
     * @return
     */
    Integer getCountByTypeIdAndSort(@Param("typeId") Integer typeId);


    /**
     * 批量删除
     * @param typeIds
     * @param status
     * @return
     */
    boolean updateBatchTypeIds(@Param("typeIds") Integer[] typeIds, @Param("status") int status);

    /**
     * 插入到关联表中
     *
     * @param typeId
     * @param subjectId
     */
    void insertSubjectType(@Param("typeId") Integer typeId, @Param("subjectId") Integer subjectId);

    /**
     * 校验是否存在
     *
     * @param typeId
     * @return
     */
    Integer checkSubjectType(@Param("typeId") Integer typeId);

    /**
     * 删除
     * @param typeId
     */
    Integer deleteSubjectType(@Param("typeId") Integer typeId);

    /**
     * 批量删除
     * @param typeIds
     */
    void deleteSubjectTypes(@Param("typeIds") Integer[] typeIds);

    /**
     * 通过TypeId获取SubjectID
     *
     * @param typeId
     * @return
     */
    Integer selectSubjectIdByTypeId(@Param("typeId")Integer typeId);
}
